import 'package:flutter/material.dart';

class Transformdemo extends StatefulWidget {
  Transformdemo({Key key}) : super(key: key);

  _TransformdemoState createState() => _TransformdemoState();
}

class _TransformdemoState extends State<Transformdemo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Transformdemo'),
      ),
      body: ListView(
        children: <Widget>[
          Container(
            decoration: BoxDecoration(color: Colors.black),
            width: 200.0,
            height: 100.0,
            child: RotatedBox(
              quarterTurns: 1, //旋转90度(1/4圈)
              child: Text(
                "Hello world",
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 20.0,
                ),
              ),
            ),
          ),
          DecoratedBox(
            decoration: BoxDecoration(color: Colors.red),
            //将Transform.rotate换成RotatedBox
            child: RotatedBox(
              quarterTurns: 2,
              child: Text("Hello world"),
            ),
          ),
        ],
      ),
    );
  }
}
